package com.seocoo.worker.user.login.model;

import com.seocoo.worker.base.Const;
import com.seocoo.worker.base.entity.ELogin;
import com.seocoo.worker.base.http.BaseRsp;
import com.seocoo.worker.base.http.DWBaseRequest;
import com.sfh.lib.AppCacheManager;

/***
 * App登录
 */
public class ReqLogin extends DWBaseRequest<BaseRsp<ELogin>> {

    /**
     * 手机号码
     */
    String phonenumber;
    /**
     * 邀请码
     */
    String promoCode;
    /**
     * 短信验证码
     */
    String smsCode;
    //登录来源，如：android-用户端
    String fromCode = "android-工人端";
    //短信类型 1:用户端登录 2:工人端登录3:银行卡绑定4:提现申请
    int smsType = 2;

    public ReqLogin(String phonenumber, String smsCode) {
        super("/api/openapi/smsLogin");
        this.phonenumber = phonenumber;
        this.smsCode = smsCode;
    }

    @Override
    public void cacheResponse(BaseRsp<ELogin> data) {
        if (data.success()) {
            //保存数据
            AppCacheManager.getPersistListener().putObject(Const.LOGIN_KEY, data.getData(), true);
        }
    }
}
